﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

public partial class Employees_EmployeeDetail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        try
        {
            Bind();

            MasterPage_MasterPage master = (MasterPage_MasterPage)this.Page.Master;
            master.HelpHref = "";
            master.PageName = "员工明细选择";
            master.PicUrl = "../image/PageIcon/emp.jpg";
            master.IntiBar();
        }
        catch(Exception ex)
        {

        }
    }


    private void Bind()
    {

        //Hashtable HT = new Hashtable();
        //HT.Add("salary", SalaryInfonew);
        //HT.Add("hr", HrInfonew);
        //HT.Add("self", PrivyInfonew);
        //HT.Add("emp", IndividualInfonew);
        //HT.Add("record", record);
        //HT.Add("contract", contract);

        //int Eid = IntiEid();
        if (Request["do"] != null)
        {
            if (!Convert.ToBoolean(Request["do"]))
            {
                
                if (Request["action"].ToString() == "edit")
                {
                    ClientScript.RegisterStartupScript(GetType(), "Msg",
                        "ymPrompt.win({title:'员工栏目选择',message:'EmployeeDetail_Choose.aspx?action=edit&mode=" + Request["mode"].ToString() + "&eid=" + Request["eid"].ToString() + "',width:500,height:180,closeBtn:false,iframe:true,allowRightMenu:false,allowSelect:false})", true);
                }
                else if (Request["action"].ToString() == "view")
                {
                    ClientScript.RegisterStartupScript(GetType(), "Msg",
                        "ymPrompt.win({title:'员工栏目选择',message:'EmployeeDetail_Choose.aspx?action=view&mode=" + Request["mode"].ToString() + "&eid=" + Request["eid"].ToString() + "',width:500,height:180,closeBtn:false,iframe:true,allowRightMenu:false,allowSelect:false})", true);
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "Msg", "location.href='EmployeesProfile.aspx?action=" + Request["action"].ToString() + "&mode=" + Server.UrlEncode(Request["mode"]).ToString() + "&eid=" + Request["eid"].ToString() + "'",true);
                
            }
        }
        else
        {
            if (Request["action"] != null)
            {
                if (Request["action"].ToString() == "add")
                {
                    ClientScript.RegisterStartupScript(GetType(), "Msg", "location.href='EmployeesProfile.aspx?action=add&mode=&eid=0'",true);
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "Msg", "ymPrompt.win({title:'员工栏目选择',message:'EmployeeDetail_Choose.aspx?action=self',width:500,height:180,closeBtn:false,iframe:true,allowRightMenu:false,allowSelect:false})", true);
            }
        }

        //PrivyInfonew.Eid = Eid;
        //IndividualInfonew.Eid = Eid;
        //HrInfonew.Eid = Eid;
        //SalaryInfonew.Eid = Eid;

        //HrInfonew.IntiBind();

        //if (Request["action"] != null)
        //{
        //    if (Request["action"].ToString() == "Add")
        //    {
        //        IndividualInfonew.Visible = true;
        //        PrivyInfonew.Visible = false;
        //        HrInfonew.Visible = false;
        //        SalaryInfonew.Visible = false;

        //        Record.Visible = false;

        //        IndividualInfonew.Action = true;

        //        return;
        //    }
        //    else if (Request["action"].ToString() == "view")
        //    {
        //        int Eid = IntiEid(true);


        //        GetMode(HT);

        //        string ShowInti = "<div class=\"ShowDiv\">";
        //        ShowInti += !SalaryInfonew.Visible ? "" : "<span><a href=\"EmployeeDetail.aspx?Eid=" + Eid + "&Mode=salary,0,0,0\">薪资信息</a></span>";
        //        ShowInti += !HrInfonew.Visible ? "" : "<span><a href=\"EmployeeDetail.aspx?Eid=" + Eid + "&Mode=0,hr,0,0\">人事信息</a></span>";
        //        ShowInti += !IndividualInfonew.Visible ? "" : "<span><a href=\"EmployeeDetail.aspx?Eid=" + Eid + "&Mode=0,0,emp,0\">人员信息</a></span>";
        //        ShowInti += !PrivyInfonew.Visible ? "" : "<span><a href=\"EmployeeDetail.aspx?Eid=" + Eid + "&Mode=0,0,0,self\">员工信息</a></span>";

        //        string salary = !SalaryInfonew.Visible ? "0" : "salary";
        //        string hr = !HrInfonew.Visible ? "0" : "hr";
        //        string emp = !IndividualInfonew.Visible ? "0" : "emp";
        //        string self = !PrivyInfonew.Visible ? "0" : "self";

        //        ShowInti += "<div style=\"text-align: right;\"><a href=\"EmployeeDetail.aspx?Eid=" + Eid +
        //            "&Mode=" + salary + "," + hr + "," + emp + "," + self + "\">浏 览 全 部</a></div>";


        //        ShowInti += "</div>";


        //        IndividualInfonew.Visible = false;
        //        PrivyInfonew.Visible = false;
        //        HrInfonew.Visible = false;
        //        SalaryInfonew.Visible = false;

        //        Record.Visible = false;
        //    }
        //    else if (Request["action"].ToString() == "readonly")
        //    {
        //        int Eid = IntiEid(false);

        //        IndividualInfonew.Visible = true;
        //        PrivyInfonew.Visible = true;
        //        HrInfonew.Visible = true;
        //        SalaryInfonew.Visible = true;

        //        SalaryInfonew.ReadOnly = true;
        //        HrInfonew.ReadOnly = true;
        //        IndividualInfonew.ReadOnly = true;
        //        PrivyInfonew.ReadOnly = true;

        //    }
        //    //this.RemovedControl(SalaryInfonew);
        //}
        //else
        //{
        //    int Eid = IntiEid(false);

        //    GetMode(HT);



        //}



    }


    //private void IntiDetail(Hashtable HT)
    //{
    //    if (Request["mode"].Length > 0)
    //    {
    //        string[] mode = Request["mode"].ToString().Split(',');

    //        for (int i = 0; i < mode.Length; i++)
    //        {
    //            if (HT[mode[i]] != null)
    //            {
    //                //HT[mode[i]]
    //            }
    //        }
            
    //    }
    //}

    //private int IntiEid()
    //{
    //    int Eid = 0;

    //    if (Request["Eid"] == null)
    //    {
    //        Eid = Convert.ToInt32(Srvtools.CliUtils.GetValue("_UserCode")[1]);
    //    }
    //    else
    //    {
    //        Eid = Convert.ToInt32(Request["Eid"]);
    //    }

    //    return Eid;
        //PrivyInfonew.Eid = Eid;
        //IndividualInfonew.Eid = Eid;
        //HrInfonew.Eid = Eid;
        //SalaryInfonew.Eid = Eid;


        //if (edit)
        //{
        //    EmpRecord.NavigateUrl = "EmpRecordSelfList.aspx?eid=" + Eid + "&redurl=" + Server.UrlEncode(Request.Url.ToString());
        //    Contract.NavigateUrl = "ContractDetail.aspx?eid=" + Eid + "&redurl=" + Server.UrlEncode(Request.Url.ToString());
        //}
        //else
        //{
        //    EmpRecord.NavigateUrl = "EmpRecordSelfList.aspx?eid=" + Eid + "&redurl=" + Server.UrlEncode(Request.Url.ToString()) + "&action=view";
        //    Contract.NavigateUrl = "ContractDetail.aspx?eid=" + Eid + "&redurl=" + Server.UrlEncode(Request.Url.ToString()) + "&action=view";
        //}

        
    //}

    //private void GetMode(Hashtable HT)
    //{


    //    if (Request["Mode"] != null)
    //    {
    //        string[] query = Server.UrlDecode(Request["Mode"].ToString()).Split(',');

    //        SalaryInfonew.Visible = HT[query[0]] != null ? true : false;
    //        HrInfonew.Visible = HT[query[1]] != null ? true : false;
    //        IndividualInfonew.Visible = HT[query[2]] != null ? true : false;
    //        PrivyInfonew.Visible = HT[query[3]] != null ? true : false;

    //        IndividualInfonew.Action = false;
    //    }
    //    else
    //    {
    //        if (Request["Eid"] == null)
    //        {
    //            PrivyInfonew.ReadOnly = false;
    //        }
    //        else
    //        {
    //            PrivyInfonew.ReadOnly = true;
    //        }
    //        SalaryInfonew.ReadOnly = true;
    //        HrInfonew.ReadOnly = true;
    //        IndividualInfonew.ReadOnly = true;

    //    }

    //}

}

